package com.cj.web;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice //描述类为spring web 模块的全局异常处理类
public class GlobalException {


    @ExceptionHandler(Exception.class)
    //只能在本类中使用
    @ResponseBody
    public String doHandleException(Exception e){
        return "123" + e.toString();
    }

}
